import { Theme } from "@/constant/theme";
import { useSystemStore } from "@/store/system";

export default function useTheme() {
  const isDarkMode = computed(() => getTheme.value == Theme.DARK);
  const { getTheme } = storeToRefs(useSystemStore());
  const { setTheme } = useSystemStore();

  const toggleTheme = () => {
    if (isDarkMode.value) setTheme(Theme.LIGHT);
    else setTheme(Theme.DARK);
  };

  return {
    isDarkMode,
    toggleTheme,
  };
}
